const fs = require("fs");

const unit="./src/units";
const result=[];
const vueReg=/\.(html)$/;
function reatdDrir(path){
  const pathes = fs.readdirSync(path);
  pathes.forEach(item=>{
    if(vueReg.test(item)){result.push({
      path:path+"/"+item,
      name:item.replace(vueReg,"")
    });}
    else{
      reatdDrir(path+"/"+item);
    }
  })
}

module.exports =(res,urlObj,bodyObj,sql) => {
  result.length=0;
  reatdDrir("./serve/uihtml");
  res.end(
    JSON.stringify({
      code: 0,
      msg: "请求成功",
      data: result
    })
  );
}
